﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MINERP.NewPB.IView;
using MINERP.NewPB.Presenter;
using MINERP.MODEL.FoundationModel;

namespace MINERP.NewPB.Forms
{
    public partial class FrmSelectPrinter : Form, ISelectPrinterView
    {
        private SelectPrinterPresenter _presenter;
        public FrmSelectPrinter()
        {
            InitializeComponent();
        }

        #region ISelectPrinterView 成员

        public int SelectedPrinterId
        {
            get { return (int)cmbPrinter.SelectedValue; }
        }

        public void BindCmbPrinter(List<Printer_Info> printerList)
        {
            cmbPrinter.DataSource = printerList;
            cmbPrinter.DisplayMember = "PName";
            cmbPrinter.ValueMember = "PrinterID";
        }

        public void CloseIt()
        {
            this.Close();
        }

        #endregion

        private void FrmSelectPrinter_Load(object sender, EventArgs e)
        {
            _presenter = new SelectPrinterPresenter(this);
        }

        private void BtnOK_Click(object sender, EventArgs e)
        {
            _presenter.SelectedPrinter();
        }

        private void cmbPrinter_DropDownClosed(object sender, EventArgs e)
        {
            _presenter.SelectedPrinter();
        }
    }
}
